STEP 8: Time to make another function! Let's create the function that will add the ball to the stage.

  • Drag Define Function between add_player() and main(). Rename this new function to add_ball().
  • Drag in Docstring so that it's the first line in add_ball().
  • This function will add a ball to the stage and set its attributes. Edit the docstring to say this.

To navigate the page using the TAB key, first press ESC to exit the code editor.

def set_stage(): """ Sets up the stage for the game """ stage.set_background("soccerfield") stage.disable_floor() def add_player(): """ Adds a player to the stage for the user to control """ player = codesters.Sprite("player1") player.go_to(0, -155) return player def main(): """ Sets up the program and calls other functions """ set_stage() player = add_player() main()
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)